package baseTest;

import java.util.Stack;

public class isPalindrome2 {
    public static void main(String[] args) {

    }
    public boolean process(ListNode head){
        Stack<ListNode> listNodes = new Stack<>();
        ListNode curNode = head;
        while (curNode != null){
            listNodes.push(curNode);
            curNode = curNode.next;
        }
        while (!listNodes.empty()){
            if (listNodes.pop().val == head.val){
                head = head.next;
            } else {
                return false;
            }
        }
        return true;
    }
}
